import React,{lazy} from "react";
import { Redirect } from "react-router-dom";

const CJXDiscover = lazy(() => import("@/pages/discover"));
const CJXRecommend = lazy(() => import("@/pages/discover/c-pages/recommend"));
const CJXRanking = lazy(() => import("@/pages/discover/c-pages/ranking"));
const CJXAlbum = lazy(() => import("@/pages/discover/c-pages/album"));
const CJXArtist = lazy(() => import("@/pages/discover/c-pages/artist"));
const CJXDjradio = lazy(() => import("@/pages/discover/c-pages/djradio"));
const CJXSongs = lazy(() => import("@/pages/discover/c-pages/songs"));
const CJXPlayer = lazy(() => import("@/pages/player"));

const CJXMine = lazy(() => import("@/pages/mine"));
const CJXFriend = lazy(() => import("@/pages/friend"));


// import CJXDiscover from "@/pages/discover";
// import CJXRecommend from "@/pages/discover/c-pages/recommend";
// import CJXRanking from "@/pages/discover/c-pages/ranking";
// import CJXAlbum from "@/pages/discover/c-pages/album";
// import CJXArtist from "@/pages/discover/c-pages/artist";
// import CJXDjradio from "@/pages/discover/c-pages/djradio";
// import CJXSongs from "@/pages/discover/c-pages/songs";
// import CJXPlayer from "@/pages/player"

// import CJXMine from "@/pages/mine";
// import CJXFriend from "@/pages/friend";


const routes = [
    {
        path: "/",
        exact: true,
        //render函数  在函数里面 重定向
        render: () => (
            <Redirect to="/discover" />
        )

    },
    {
        path: "/discover",
        component: CJXDiscover,
        routes: [
            {
                path: "/discover",
                exact: true,
                render: () => (
                    <Redirect to="/discover/recommend"/>
                )
            },
            {
                path: "/discover/recommend",
                component: CJXRecommend
            },
            {
                path: "/discover/ranking",
                component: CJXRanking
            },
            {
                path: "/discover/album",
                component: CJXAlbum
            },
            {
                path: "/discover/artist",
                component: CJXArtist
            },
            {
                path: "/discover/djradio",
                component: CJXDjradio
            },
            {
                path: "/discover/songs",
                component: CJXSongs
            },
            {
                path: "/discover/player",
                component: CJXPlayer
            },
        ]
    },
    {
        path: "/mine",
        component: CJXMine
    },
    {
        path: "/friend",
        component: CJXFriend
    },
];

export default routes;